package edu.thu.studio.ormdesigner.util;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class DataTypeUtils {
    
    /**
     * 字段类型，及字类型非空设置
     */
    private static String[] dataType = {"int", "number", "varchar", "date", "datetime", "clob", "blob"};
    private static Map<String, String> _int_ = new HashMap<String, String>();
    private static Map<String, String> _number_ = new HashMap<String, String>();
    private static Map<String, String> _varchar_ = new HashMap<String, String>();
    private static Map<String, String> _date_ = new HashMap<String, String>();
    private static Map<String, String> _datetime_ = new HashMap<String, String>();
    private static Map<String, String> _clob_ = new HashMap<String, String>();
    private static Map<String, String> _blob_ = new HashMap<String, String>();
    private static List<Map<String, String>> dataTypeValidate = new ArrayList<Map<String, String>>();
    
    private static Map<String, String> get_int_() {
        _int_.put("int", "");
        return _int_;
    }
    
    private static Map<String, String> get_number_() {
        _number_.put("number", "");
        return _number_;
    }
    
    private static Map<String, String> get_varchar_() {
        _varchar_.put("varchar", "!null");
        return _varchar_;
    }
    
    private static Map<String, String> get_datetime_() {
        _datetime_.put("datetime", "");
        return _datetime_;
    }
    
    private static Map<String, String> get_clob_() {
        _clob_.put("clob", "");
        return _clob_;
    }
    
    private static Map<String, String> get_blob_() {
        _blob_.put("blob", "");
        return _blob_;
    }
    
    private static Map<String, String> get_date_() {
        _date_.put("date", "");
        return _date_;
    }
    
    public static List<Map<String, String>> getDataTypeValidate() {
        dataTypeValidate.add(get_int_());
        dataTypeValidate.add(get_number_());
        dataTypeValidate.add(get_varchar_());
        dataTypeValidate.add(get_date_());
        dataTypeValidate.add(get_datetime_());
        dataTypeValidate.add(get_blob_());
        dataTypeValidate.add(get_clob_());
        return dataTypeValidate;
    }
    
    public static String[] getDataType() {
        return dataType;
    }
    
}
